import 'package:flutter/material.dart';
import 'package:flutter_deer/account/iview/take_out_iview.dart';
import 'package:flutter_deer/account/models/take_out_entity.dart';
import 'package:flutter_deer/mvp/base_page_presenter.dart';
import 'package:flutter_deer/net/base_entity.dart';
import 'package:flutter_deer/net/dio_utils.dart';
import 'package:flutter_deer/net/http_api.dart';


class TakeOutPagePresenter extends BasePagePresenter<TakeOutIMvpView> {

  @override
  void initState() {
    WidgetsBinding.instance.addPostFrameCallback((_) {
      requestNetwork<BaseEntity<List<TakeOutEntity>>>(Method.get,
          url: HttpApi.takeOutList,
          onSuccess: (data) {
            List<TakeOutEntity> takeOutList = data?.data ?? [];
            view.setTakeOutList(takeOutList);
          },
          onError: (code, msg) {

          }
      );
    });
  }
}